<?php
// 索引数组
$colors = ["红", "绿", "蓝"];
echo "第一个颜色：" . $colors[0] . "\n";

// 关联数组
$student = [
    "name" => "王五",
    "age" => 22,
    "major" => "计算机科学"
];
echo "学生姓名：" . $student["name"] . "\n";

// 多维数组
$students = [
    ["name" => "张三", "age" => 20],
    ["name" => "李四", "age" => 21],
    ["name" => "王五", "age" => 22]
];
echo "第二个学生：" . $students[1]["name"] . "，年龄：" . $students[1]["age"] . "\n";

// 遍历多维数组
foreach ($students as $student) {
    echo "姓名：" . $student["name"] . "，年龄：" . $student["age"] . "\n";
}
?>